aa11adc467746418a9d7c729b70dd27432a5a9c3,clc/modules/image-manager/src/main/java/edu/ucsb/eucalyptus/cloud/ws/ImageManager.java,ImageManager,verify,#VmAllocationInfo#,151
Before Change
db.rollback( );
throw new EucalyptusCloudException( "You do not have permission to launch: " + diskInfo.getImageId( ) );
}
if ( !kernelInfo.isAllowed( user ) ) {
db.rollback( );
throw new EucalyptusCloudException( "You do not have permission to launch: " + kernelInfo.getImageId( ) );
}
if ( ramdiskId != null ) {
try {
ramdiskInfo = db.getUnique( new ImageInfo( ramdiskId ) );
} catch ( EucalyptusCloudException e ) {
db.rollback( );
throw new EucalyptusCloudException( "Failed to find ramdisk image: " + ramdiskId );
}
if ( !ramdiskInfo.isAllowed( user ) ) {
db.rollback( );
throw new EucalyptusCloudException( "You do not have permission to launch: " + ramdiskInfo.getImageId( ) );
}
}
db.commit( );
if( !"kernel".equals( kernelInfo.getImageType( ) ) ) {
throw new EucalyptusCloudException( "Image specified is not a kernel: " + kernelInfo.toString( ) );
}
if((ramdiskInfo != null) && !"ramdisk".equals( ramdiskInfo.getImageType( ) ) ) {
throw new EucalyptusCloudException( "Image specified is not a ramdisk: " + ramdiskInfo.toString( ) );
}
ImageUtil.checkStoredImage( kernelInfo );
ImageUtil.checkStoredImage( ramdiskInfo );
}
ArrayList<String> ancestorIds = ImageUtil.getAncestors( msg.getUserId( ), diskInfo.getImageLocation( ) );
After Change
db.rollback( );
throw new EucalyptusCloudException( "Failed to find kernel image: " + kernelId );
}
if ( !kernelInfo.isAllowed( user ) ) {
db.rollback( );
throw new EucalyptusCloudException( "You do not have permission to launch: " + kernelInfo.getImageId( ) );
}
if( !"kernel".equals( kernelInfo.getImageType( ) ) ) {
throw new EucalyptusCloudException( "Image specified is not a kernel: " + kernelInfo.toString( ) );
}
if( !ImageManager.IMAGE_PLATFORM_WINDOWS.equals( diskInfo.getPlatform( ) ) ) {
boolean nord = ( ImageUtil.isSet( msg.getKernelId( ) ) && !ImageUtil.isSet( msg.getRamdiskId( ) ) );
nord |= ( !ImageUtil.isSet( msg.getKernelId() ) && ImageUtil.isSet( diskInfo.getKernelId( ) ) && !ImageUtil.isSet( diskInfo.getRamdiskId() ) && !ImageUtil.isSet( msg.getRamdiskId() ) );
String ramdiskId = nord?null:ImageUtil.getImageInfobyId( msg.getRamdiskId( ), diskInfo.getRamdiskId( ), defaultRamdiskId );
if ( !diskInfo.isAllowed( user ) ) {
db.rollback( );
throw new EucalyptusCloudException( "You do not have permission to launch: " + diskInfo.getImageId( ) );
}
if ( ramdiskId != null ) {
try {
ramdiskInfo = db.getUnique( new ImageInfo( ramdiskId ) );
} catch ( EucalyptusCloudException e ) {
db.rollback( );
throw new EucalyptusCloudException( "Failed to find ramdisk image: " + ramdiskId );
}
if ( !ramdiskInfo.isAllowed( user ) ) {
db.rollback( );
throw new EucalyptusCloudException( "You do not have permission to launch: " + ramdiskInfo.getImageId( ) );
}
}
db.commit( );
if((ramdiskInfo != null) && !"ramdisk".equals( ramdiskInfo.getImageType( ) ) ) {
throw new EucalyptusCloudException( "Image specified is not a ramdisk: " + ramdiskInfo.toString( ) );
}
ImageUtil.checkStoredImage( ramdiskInfo );
}
ArrayList<String> ancestorIds = ImageUtil.getAncestors( msg.getUserId( ), diskInfo.getImageLocation( ) );
Long imgSize = ImageUtil.getSize( msg.getUserId( ), diskInfo.getImageLocation( ) );
ImageUtil.checkStoredImage( kernelInfo );
ImageUtil.checkStoredImage( diskInfo );
// :: get together the required URLs ::/